package comhw1029;

public class Order {
    private String orderID = "0001";
    private double total;
    private Item[] orderItem = new Item[3];

    public Item[] makeOrder(Item item, Book[] books){
        for (int i = 0; i < orderItem.length; i++){
            Book thebook = item.whichBook(books);
            int bookQuant = item.howMany();
            orderItem[i] = new Item(thebook, bookQuant);
        }
        return orderItem;
    }

    public void printOrderID(){
        System.out.println(this.orderID);
    }

    public double countTotal(Item[] items){
        for (int i = 0; i < items.length; i++){
            this.total += items[i].getBook().getPrice()*items[i].getQuantity();
        }
        return this.total;
    }
}
